<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page import="java.util.*" %>
<%@ page import="com.example.web4.User" %><%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2022/10/8
  Time: 8:23
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
  <head>
    <title>迭代</title>
  </head>
  <body>
  <% List<User> list = new ArrayList<>();
  list.add(new User("张三","123456"));
    list.add(new User("希尔","123456"));

    list.add(new User("李四","123456"));

    list.add(new User("王五","123456"));

    list.add(new User("赵六","123456"));
    request.setAttribute("list",list);
  %>

  <table border="1">
    <tr>
      <td colspan="2">FORENCH迭代</td>
    </tr>
    <tr>
      <td>用户名</td>
      <td>密码</td>
    </tr>
  <c:forEach items="<%=list%>" var="rel" begin="0" end="5" step="1" varStatus="list">
    <tr>
      <td>
        ${rel.username}
      </td>
      <td>
          ${rel.password}
      </td>
    </tr>
    </c:forEach>

  </table>
  </body>
</html>
